﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Estore.Models;
using Estore.ViewModels;
namespace Estore.Controllers
{
    public class IndexController : Controller
    {
        //
        // GET: /Index/
        public EFEstoreRepository repository = new EFEstoreRepository();
        public ActionResult Index()
        {
          IEnumerable<Product>  allproduct = repository.FindAllProduct();
         var allpro = from p in allproduct
                       select new ProductModel
                       {
                           Product_id = p.Product_id,
                           Product_name = p.Product_name,
                           Category_id = p.Category_id,
                           price = p.Price,
                           Image = p.Image,
                           Description = p.Description
                       };

          
         
          return View(allpro);
        }
        public ActionResult showslidebar()
        {

            var category = repository.Findcategory();
            return PartialView("showslidebar",category);
        }

    }
}
